<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<?php
require_once "../php/objetos/Email.php";
require_once "../php/objetos/Usuario.php";
session_start();
if (!array_key_exists("userId", $_SESSION) && $_SESSION["userId"] == NULL) {
    header("Location: ../index.php");
}
$userId = $_SESSION["userId"];
$email = $_SESSION["email"];
unset($_SESSION["email"]);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../css/style.css"/>
        <title>WEBEMAIL</title>
    </head>
    <body>
        <div id="header">
            <img src="../css/imagens/header.jpg" />
            <div id="logout">
                Bem Vindo, 
                <?php
                echo $userId->getNome();
                ?>

                <a href="../php/Logout.php"><img src="../css/imagens/exit.png" height="20" width="20" /></a>
            </div>
        </div>
        <div id="page">
        <div id="menu">
            <h4>Menu</h4>
            <ul>
                <li><a href="principal.php"><img alt="seta" src="../css/imagens/btn_seta_2.png" class="iconSeta"/>Caixa de Entrada</a></li>
                <li><a href="lixeira.php">Lixo</a></li>
                <li><a href="rascunho.php">Rascunho</a></li>
                <li><a href="itensEnviados.php">Itens Enviados</a></li>
            </ul>
        </div>
        <div id="content">
            <?php if ($email != null) { ?>
                <div id="menuEmail">
                    <ul>
                        <li><a alt="responder" href="../php/ResponderEmail.php?idEmail=<?php echo $email->getId(); ?>">Responder</a></li>
                    </ul>
                </div>
                <h4><?php echo $email->getAssunto(); ?></h4>
                <div id="cabecalhoEmail">
                    <table>
                        <td>
                        <tr>
                            <td><strong>Remetente:</strong></td>
                            <td><?php echo $email->getRemetente(); ?></td>
                        </tr>
                        <tr>
                            <td><strong>Data de Recebimento:</strong></td>
                            <td><?php echo $email->getDataRecebido(); ?></td>
                        </tr>
                        <tr>
                            <td><strong>Data de Envio:</strong></td>
                            <td><?php echo $email->getDataEnviado(); ?></td>
                        </tr>
                        </td>
                    </table>
                </div>
                <div id="conteudoEmail" style="background: #FFF;">
                    <?php echo $email->getConteudo(); ?>
                </div>
                
            <?php
            } else {
                header("Location: principal.php");
            }
            ?>
        </div>
        </div>
        <div id="footer">
            @WebMail Todos Direitos Reservados
        </div>
    </body>
</html>
